<template>
	<!-- //审批拒绝弹窗 -->
	<el-dialog title="审核拒绝" center v-model="dialogVisible" width="536" class="radius8" :before-close="handleClose">
		<div>
			<div class="fs16">
				否决{{getText()}}，需要填写否决原因
			</div>
			<div class="mt15">
				<el-input size="large" type="textarea" resize="none" class="textReset"
				show-word-limit v-model="reason"
					:rows="6"  :placeholder="'请填写否决'+getText()+'原因'" maxlength="300" />
			</div>
			<div slot="footer" class="dialog-footer text-right mt30">
				<el-button class="cancelSubBtn" @click="result = '',dialogVisible = false">取 消</el-button>
				<el-button type="primary" @click="resultSubmit()" class="mainSubBtn">确 定</el-button>
			</div>
		</div>
	</el-dialog>
</template>

<script>
	import{
		auditOrder,
	} from "@/api/business/order"
	export default{
		props:{
			item:{
				type:Object,
				default:res=>{return {}}
			},
			type:{
				type:Number,
				default:0//0:退款  1：回款
			}
		},
		data(){
			return{
				dialogVisible:false,//结束订弹窗
				reason:''
			}
		},
		methods:{
			getText(){
				switch (this.type*1){
					case 0:
						return '退款'
						break;
					case 1:
						return '回款'
						break;	
					default:
						break;
				}
			},
			open(){
				this.dialogVisible = true
			},
			handleClose(){
				this.dialogVisible = false
			},
			//提交
			resultSubmit(){
				//审核拒绝
				this.item.flyflow.approveResult = false
				this.item.flyflow.approveDesc = this.reason
				auditOrder(this.item).then(res=>{
					this.$modal.msgSuccess('已提交')
					this.dialogVisible = false
					this.$emit('refresh')
				})
			}
		}
	}
</script>

<style>
</style>